<?php
/**
 * Created by INGEPHP CURD.
 * User:
 * Date: 2018/10/17
 * Time: 10:17
 */

namespace app\admin\controller\view;

use app\common\controller\Admin;
use app\common\facade\Addons;
use think\facade\Request;
use think\Loader;

class AddonsController extends Admin
{
    /**
     * 列表视图显示
     * @method get
     * @param
     * @return
     */
    public function index()
    {
        return $this->fetch();
    }

    /**
     * 编辑配置文件
     * @method get
     * @param $id int 需要编辑配置数据的id
     * @return
     */
    public function options($d_id)
    {
        $d_id = Loader::parseName($d_id);
        $this->assign('d_id', $d_id);
        $options = Addons::getOptions($d_id);
        $this->assign('options', $options['data']);
        $options_val = Addons::getAddonsOptions($d_id);
        $this->assign('options_val', $options_val['data']);
        return $this->fetch();
    }
}